#include "Configuration.h"
#include "DirScanner.h"
#include <fstream>
#include <iostream>

using std::cout;
using std::endl;
using std::ofstream;

Configuration* Configuration::pCnof = nullptr;
Configuration::AutoRelease Configuration::release;


//测试的时候单例模式的初始化应该放在正式运行的main文件下
//不然会报重复定义错误
int main()
{
    Configuration* cp = Configuration::getInstance();
    map<string, string> mp = cp->getConfigMap();

/*    for(auto & elem : mp)
    {
        cout << elem.first << " " <<  elem.second << endl;
    }
*/
    set<string> tmp = cp->getStopWordList();
    //getstop函数也会调用scan去把所有停用词文件路径找到，然后在逐个打开初始化set
/*
    for(set<string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
    {
        string s = *it;
         cout << "s " << s << endl; 
    }    
*/

    DirScanner dirs;
    string path = mp.find("yuliao")->second;
    dirs(path);//执行operator()，就是用traverse获得所有语料文件路径
 
/*    
    for(auto & elem : dirs.getfiles())
    {
        cout << elem << endl;
    }
*/


}
